<include file="Public/min-header"/>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <nav class="navbar navbar-default">
                            <div class="collapse navbar-collapse">
                                <form class="navbar-form form-inline" method="get">
                                    <div class="form-group">
                                        <input type="text" name="title" class="form-control" placeholder="标题" />
                                    </div>
                                    <div class="form-group">
                                        <input type="text" name="account" class="form-control" placeholder="会员帐号" />
                                    </div>
                                    <button type="submit" class="btn btn-default">提交</button>
                                </form>
                            </div>
                        </nav>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <table id="list-table" class="table table-bordered table-striped dataTable" role="grid"
                                       aria-describedby="example1_info">
                                    <thead>
                                    <tr role="row">
                                        <th>序号</th>
                                        <th>留言标题</th>
                                        <th>会员昵称</th>
                                        <th>状态</th>
                                        <th>留言时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <foreach name="list" item="v" key="k">
                                        <tr role="row" align="center">
                                            <td>{$v.id}</td>
                                            <td>{$v.title|getSubstr=0,33}</td>
                                            <td>{$v.user_name}</td>
                                            <td>
                                                <switch name="v.type">
                                                    <case value='1'>待回复</case>
                                                    <case value='2'>己回复</case>
                                                </switch>
                                            </td>
                                            <td>{$v.zf_time|date="Y-m-d H:i:s",###}</td>
                                            <td>
                                                <if condition="$v.type eq 2">
                                                    <a href="__CONTROLLER__/checkMessage/id/{$v.id}" target="_self">查看</a>｜
                                                    <else/>
                                                    <a href="__CONTROLLER__/reply/id/{$v.id}" target="_self">回复</a>｜
                                                </if>
                                                <a href="__CONTROLLER__/del_message/id/{$v.id}" onclick="return confirm('您确定要删除吗？');" target="_self"><b style="color:red">删除</b></a>
                                            </td>
                                        </tr>
                                    </foreach>
                                    </tbody>
                                    <tfoot>

                                    </tfoot>
                                </table>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 text-left"></div>
                            <div class="col-sm-6 text-right">{$page}</div>
                        </div>
                    </div><!-- /.box-body -->
                </div><!-- /.box -->
            </div>
        </div>
    </section>
</div>
<script>
    function delfun(obj) {
        if (confirm('确认删除')) {
            $.ajax({
                type: 'post',
                url: $(obj).attr('data-url'),
                data: {act: 'del', article_id: $(obj).attr('data-id')},
                dataType: 'json',
                success: function (data) {
                    if (data) {
                        $(obj).parent().parent().remove();
                    } else {
                        layer.alert('删除失败', {icon: 2});  //alert('删除失败');
                    }
                }
            })
        }
        return false;
    }

    /*
     * 清除文章静态页面缓存
     */
    function ClearAritcleHtml(article_id) {
        $.ajax({
            type: 'GET',
            url: "{:U('Admin/System/ClearAritcleHtml')}",
            data: {article_id: article_id},
            dataType: 'json',
            success: function (data) {
                layer.alert(data.msg, {icon: 2});
            }
        });
    }

</script>
</body>
</html>